package cn.wolfcode.wolf2w.domain;

import org.springframework.data.annotation.Transient;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 游记
 */
@Document("travel")
public class Travel extends BaseDomain {

    public static final int STATE_NORMAL = 0;  //草稿
    public static final int STATE_WAITING = 1;  //待发布(审核中)
    public static final int STATE_RELEASE = 2;  //发布(审核通过)
    public static final int STATE_REJECT = 3;  //拒绝

    public static final int ISPUBLIC_NO = 0;
    public static final int ISPUBLIC_YES = 1;


    private String destId;  //目的地

    private String destName;  //目的地
    @Transient
    private Destination dest;  //目的地

    private String userId;  //作者

    @Transient
    private UserInfo author;  //作者

    private String title;  //标题

    private String coverUrl; //封面

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date travelTime; //旅游时间

    private int perExpend; //人均消费

    private int day;  //旅游天数

    private int person;  //和谁旅游

    private Date createTime; //创建时间

    private Date releaseTime; //发布时间

    private Date lastUpdateTime; //最新更新时间内

    private int isPublic=ISPUBLIC_NO; //是否发布

    private int viewnum;  //点击/阅读数

    private int replynum; //回复数

    private int favornum;//收藏数

    private int sharenum;//分享数

    private int thumbsupnum;//点赞数

    private int state = STATE_NORMAL;//游记状态

    private String summary;//概要

    private String content;

    public static int getStateNormal() {
        return STATE_NORMAL;
    }

    public static int getStateWaiting() {
        return STATE_WAITING;
    }

    public static int getStateRelease() {
        return STATE_RELEASE;
    }

    public static int getStateReject() {
        return STATE_REJECT;
    }

    public static int getIspublicNo() {
        return ISPUBLIC_NO;
    }

    public static int getIspublicYes() {
        return ISPUBLIC_YES;
    }

    public String getDestId() {
        return destId;
    }

    public void setDestId(String destId) {
        this.destId=destId;
    }

    public String getDestName() {
        return destName;
    }

    public void setDestName(String destName) {
        this.destName=destName;
    }

    public Destination getDest() {
        return dest;
    }

    public void setDest(Destination dest) {
        this.dest=dest;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId=userId;
    }

    public UserInfo getAuthor() {
        return author;
    }

    public void setAuthor(UserInfo author) {
        this.author=author;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title=title;
    }

    public String getCoverUrl() {
        return coverUrl;
    }

    public void setCoverUrl(String coverUrl) {
        this.coverUrl=coverUrl;
    }

    public Date getTravelTime() {
        return travelTime;
    }

    public void setTravelTime(Date travelTime) {
        this.travelTime=travelTime;
    }

    public int getPerExpend() {
        return perExpend;
    }

    public void setPerExpend(int perExpend) {
        this.perExpend=perExpend;
    }

    public int getDay() {
        return day;
    }

    public void setDay(int day) {
        this.day=day;
    }

    public int getPerson() {
        return person;
    }

    public void setPerson(int person) {
        this.person=person;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime=createTime;
    }

    public Date getReleaseTime() {
        return releaseTime;
    }

    public void setReleaseTime(Date releaseTime) {
        this.releaseTime=releaseTime;
    }

    public Date getLastUpdateTime() {
        return lastUpdateTime;
    }

    public void setLastUpdateTime(Date lastUpdateTime) {
        this.lastUpdateTime=lastUpdateTime;
    }

    public int getIsPublic() {
        return isPublic;
    }

    public void setIsPublic(int isPublic) {
        this.isPublic=isPublic;
    }

    public int getViewnum() {
        return viewnum;
    }

    public void setViewnum(int viewnum) {
        this.viewnum=viewnum;
    }

    public int getReplynum() {
        return replynum;
    }

    public void setReplynum(int replynum) {
        this.replynum=replynum;
    }

    public int getFavornum() {
        return favornum;
    }

    public void setFavornum(int favornum) {
        this.favornum=favornum;
    }

    public int getSharenum() {
        return sharenum;
    }

    public void setSharenum(int sharenum) {
        this.sharenum=sharenum;
    }

    public int getThumbsupnum() {
        return thumbsupnum;
    }

    public void setThumbsupnum(int thumbsupnum) {
        this.thumbsupnum=thumbsupnum;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state=state;
    }

    public String getSummary() {
        return summary;
    }

    public void setSummary(String summary) {
        this.summary=summary;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content=content;
    }

    public String getStateDisplay(){
        if (state ==STATE_NORMAL ){
            return "编辑中";
        }else if(state ==STATE_WAITING ){
            return "待发布";
        }else if(state ==STATE_RELEASE ){
            return "已发布";
        }else if(state ==STATE_REJECT ){
            return "已拒绝";
        }
        return "";
    }

    public String getPersonDisplay(){
       if (person == 1){
           return "一个人";
       }else if (person == 2){
           return "情侣/夫妻";
       }else if (person == 3){
           return "带孩子";
       }else if (person == 4){
           return "家庭出游";
       }else if (person == 5){
           return "和朋友";
       }else if (person == 6){
           return "和同学";
       }else if (person == 7){
           return "其它";
       }
       return "其它";
    }
}